package com.ljc.cjgl.entitiy.bbs;

import com.ljc.cjgl.security.SysUser;
import org.springframework.data.annotation.CreatedBy;

import javax.persistence.*;
import java.util.Date;

/**
 * Created with IntelliJ IDEA.
 * Description: 评论实体
 * Author: JavaJun
 * Date: 2019-05-05 8:40
 */
@Entity
public class Comment {
    private Integer id;
    // 帖子
    private Article article;
    // 用户
    private SysUser sysUser;
    // 评论内容
    private String content;
    // 时间
    private Date inTime;

    @Id
    @GeneratedValue
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    @ManyToOne
    public Article getArticle() {
        return article;
    }

    public void setArticle(Article article) {
        this.article = article;
    }

    @ManyToOne
    @CreatedBy
    public SysUser getSysUser() {
        return sysUser;
    }

    public void setSysUser(SysUser sysUser) {
        this.sysUser = sysUser;
    }

    @Lob
    @Column(columnDefinition = "MEDIUMTEXT", nullable = true)
    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    @Temporal(TemporalType.TIMESTAMP)
    public Date getInTime() {
        return inTime;
    }

    public void setInTime(Date inTime) {
        this.inTime = inTime;
    }
}
